package com.dc.adaper;

import com.dc.app.R;
import com.dc.app.R.drawable;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {

	public static final Integer[] imageList={
		R.drawable.img_0,
		R.drawable.img_1,
		R.drawable.img_2,
		R.drawable.img_3,
		R.drawable.img_4,
		R.drawable.img_5,
		R.drawable.img_6,
		R.drawable.img_7,
		R.drawable.img_8
	};
	private Context content;
	public ImageAdapter(Context content){
		this.content=content;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return imageList.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return imageList[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageView imageView=new ImageView(content);
		imageView.setImageResource(imageList[position]);
		imageView.setMaxWidth(32);
		imageView.setMaxHeight(32);
		imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
		return imageView;
	}

}
